import { useUserData } from '@/hooks/useUserData';
import { VERSION_TYPE } from '@/enum/version';

const { LOCAL_LABEL_PREFIX, SAVE_STATE_KEYS } = useUserData();

const userLocalLabel = uni.getStorageSync(LOCAL_LABEL_PREFIX);

interface ILifeData {
	[propname : string] : any;
}




let lifeData : null | ILifeData = null;

try {
	lifeData = uni.getStorageSync(userLocalLabel);
} catch (e) {
	console.log(e)
}

export default <IStoreState>{
	userInfo: lifeData ? lifeData.userInfo : null,
	// version:  Number(lifeData ?lifeData.version?lifeData.version:import.meta.env.VITE_VERSION_TYPE:import.meta.env.VITE_VERSION_TYPE),
	// baseUrl:lifeData?lifeData.baseUrl?lifeData.baseUrl:import.meta.env.VITE_BASE_URL:import.meta.env.VITE_BASE_URL,
	version:Number(import.meta.env.VITE_VERSION_TYPE),
	baseUrl:import.meta.env.VITE_BASE_URL,
	website:`${window.location.origin}/#`,
}